//contour approximation is construction of new contour with lesser number of nodes,
//that repeats original one as precise as possible
#pragma once

#include "outline.h"

namespace outline {

///approximation of single outline
///\param it is acceptable for src and dst to coincide
///\return measure of discrepancy between nodes of source outline and approximated outline
template <typename T, typename U>
double approximate_min_step_len(int min_step_len,
	std::vector< point<T> > const & src, std::vector< point<U> > & dst);

///approximation of multiple outlines
///\param it is acceptable for src and dst to coincide
///\return summed measure of discrepancy between nodes of source outlines and approximated outlines
template <typename T, typename U>
double approximate_min_step_len(int min_step_len,
	std::vector<std::vector<point<T> > > const & src, std::vector<std::vector<point<U> > > & dst);

///new contour will consist exactly from K nodes
template <typename T, typename U>
double approximate_to_K_nodes(int K,
	std::vector< point<T> > const & src, std::vector< point<U> > & dst);

template <typename T, typename U>
double approximate_avg_step_len(float avg_step_len,
	std::vector<std::vector<point<T> > > const & src, std::vector<std::vector<point<U> > > & dst);

///(minimal number of nodes is leaved providing error less than given argument)
template <typename T, typename U>
double approximate_max_discrepancy(double max_discrepancy,
	std::vector< point<T> > const & src, std::vector< point<U> > & dst);

///avg_discrepancy is total discrepancy divided by node count in source contours
template <typename T, typename U>
double approximate_avg_discrepancy(double avg_discrepancy,
	std::vector<std::vector<point<T> > > const & src, std::vector<std::vector<point<U> > > & dst);

} //namespace outline
